//
//  ShareDataView.m
//  Yihubang
//
//  Created by xmy on 16/9/5.
//  Copyright © 2016年 jinghao. All rights reserved.
//

#import "ShareDataView.h"

@implementation ShareDataView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

-(void)awakeFromNib{
    [super awakeFromNib];
    [self.backView setTapActionWithBlock:^(UIGestureRecognizer *gestureRecoginzer) {
        [self removeFrom];
    }];

}
-(NSDictionary *)shareData{
    if(!_shareData){
        _shareData= [NSDictionary dictionary];
    }
    return _shareData;
}
- (IBAction)shareDataTo:(id)sender {
    NSMutableDictionary * content =[[NSMutableDictionary alloc] initWithDictionary:self.shareData];
    [content setObject:[NSString stringWithFormat:@"%ld",(long)[sender tag]] forKey:@"snsType"];
    [self.shareDataDelegate shareContentOfApp:content];
    [self removeFrom];
}
-(void)removeFrom{
    [[NSNotificationCenter defaultCenter] postNotificationName:@"ShowNavigationBar" object:nil];
    @weakify(self)
    [UIView animateWithDuration:0.4 animations:^{
        @strongify(self);
        self.alpha=0.0f;
        self.shareDataDelegate =nil;
    } completion:^(BOOL finish){
        [self removeFromSuperview];
    }];
}
@end
